package com.hh.mybatisplus.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Accessors(chain = true)
public class User {
    //对应数据库的主键(uuid, 自增id, redis, zookeeper, 雪花算法)
    //@TableId(type = IdType.AUTO)主键自增策略 需要配置主键自增 数据库自增
    //@TableId(type = IdType.NONE)没有操作 未设置主键
    //@TableId(type = IdType.INPUT)手动输入
    //@TableId(type = IdType.ID_WORKER)默认的全局ID
    //@TableId(type = IdType.UUID)全局唯一ID
    //@TableId(type = IdType.ID_WORKER_STR) ID_WORKER的字符串表示
    @TableId(type = IdType.ID_WORKER)
    private Long id;
    private String name;
    private Integer age;
    private String email;
    @Version
    private Long version;
    //字段添加填充内容
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    //字段添加更新填充内容
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;
    @TableLogic // 逻辑删除
    private Integer deleted;
}
